#include "app_buffer.h"

int main(int argc, char const *argv[])
{
    // 初始化缓冲区
    Buffer *buffer = app_buffer_init(30);
    // 写入数据
    app_buffer_write(buffer, "hello world", 11);
    app_buffer_write(buffer, "hello hahaha", 12);
    // 写入数据
    app_buffer_write(buffer, "hello world", 11);
    // 读取数据
    char buf[30];
    int len = app_buffer_read(buffer, buf, sizeof(buf));
    printf("%.*s\n", len, buf);
    char buf2[30];
    int len2 = app_buffer_read(buffer, buf2, sizeof(buf2));
    printf("%.*s\n", len2, buf2);
    // 读取数据
    char buf3[30];
    app_buffer_read(buffer, buf3, sizeof(buf3));
    // 释放缓冲区
    app_buffer_free(buffer);
    return 0;
}

